package Framework
{
	import Box2D.Collision.b2AABB;
	import Box2D.Common.Math.b2Vec2;
	import Box2D.Common.b2Color;
	import Box2D.Dynamics.b2DebugDraw;
	
	public class DebugDraw extends b2DebugDraw
	{
		public function DebugDraw()
		{
			super();
		}
		public function DrawPoint(p:b2Vec2,size:Number,color:b2Color):void
		{
			sprite.graphics.beginFill(color.color, fillAlpha);
			sprite.graphics.drawCircle(p.x * drawScale, p.y * drawScale, size);
			sprite.graphics.endFill();
		}
		public function DrawPolygonAlpha(vertices:Array,vertexCount:int,color:b2Color,alpha:Number,fillAlpha:Number):void{
			sprite.graphics.lineStyle(lineThickness, color.color, alpha);
			sprite.graphics.moveTo(vertices[0].x * drawScale, vertices[0].y * drawScale);
			sprite.graphics.beginFill(color.color, fillAlpha);
			for (var i:int = 1; i < vertexCount; i++)
			{
				sprite.graphics.lineTo(vertices[i].x * drawScale, vertices[i].y * drawScale);
			}
			sprite.graphics.lineTo(vertices[0].x * drawScale, vertices[0].y * drawScale);
			sprite.graphics.endFill();			
		}
		public function DrawAABB(aabb:b2AABB,color:b2Color):void{
			sprite.graphics.lineStyle(lineThickness, color.color, alpha);
			sprite.graphics.moveTo(aabb.lowerBound.x * drawScale,aabb.lowerBound.y * drawScale);
			sprite.graphics.lineTo(aabb.upperBound.x * drawScale,aabb.lowerBound.y * drawScale);
			sprite.graphics.lineTo(aabb.upperBound.x * drawScale,aabb.upperBound.y * drawScale);
			sprite.graphics.lineTo(aabb.lowerBound.x * drawScale,aabb.upperBound.y * drawScale);
			sprite.graphics.lineTo(aabb.lowerBound.x * drawScale,aabb.lowerBound.y * drawScale);
			sprite.graphics.endFill();
		}	
	}
}